<template>
  <div>
    <span>搜索内容</span>
    <el-input
      type="text"
      style="width:181px;"
      suffix-icon="el-icon-search"
      @focus="query"
    />
    <el-table
      ref="generalDialogTable"
      height="560px"
      style="width:100%;overflow:auto;margin-top:10px"
      :data="generalData"
      @row-click="selectRow"
    >
      <el-table-column width="40">
        <template slot-scope="scope">
          <el-radio
            v-model="radio"
            :label="scope.$index"
            @change.native="selectRow(scope.row)"
          >&nbsp;</el-radio>
        </template>
      </el-table-column>
      <el-table-column
        v-for="item in tableHead"
        :key="item.label"
        :label="item.label"
        :property="item.property"
        :width="item.width"
      />
    </el-table>
  </div>
</template>

<script>
export default {
  props: {
    generalData: {
      type: Array,
      default: function () {
        return []
      }
    },
    tableHead: {
      type: Array,
      default: function () {
        return []
      }
    },
    radio: {
      type: Number,
      default: 0
    }
  },
  data () {
    return {
      radioRow: -1
    }
  },
  watch: {},
  mounted () {
  },
  created () {
  },
  methods: {
    selectRow: function (row) {
      const index = this.generalData.indexOf(row)
      this.$emit('selectRow', row, index)
    },
    query: function () {

    }

  }
}
</script>
